define(function (require, exports) { 'use strict'; //@ngInject exports.redirectOnLogin = function ($window, lpCoreBus, lpPortal) { return { restrict: ['A'], link: function () { lpCoreBus.subscribe('login-success', function (response) { if ($window.location.protocol.indexOf('file:') === 0) { response.successView = null; } if (response.successView) { $window.location.replace(lpPortal.root + response.successView); } else { var currentLocation; if ($window.location.protocol.indexOf('file:') === 0) { currentLocation = $window.location.pathname.split('//')[0] + $window.location.search + $window.location.hash; } else { currentLocation = $window.location.href; } $window.location.replace(currentLocation); } }); } }; }; });